package com.xunheyun.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.xunheyun.vo.HostServer;

@Mapper
public interface ServerMapper {

	
	@Select("select * from xhy_server where config_server_id = #{configServerId}")
	public List<HostServer> list(@Param("configServerId") int configServerId);
	
	@Insert("insert into xhy_server (server_name,server_ip,server_user,server_pwd,server_desc,config_server_id,config_dir) values "
			+ "(#{server_name},#{server_ip},#{server_user},#{server_pwd},#{server_desc},#{config_server_id},#{config_dir})")
	public int add(HostServer server);
	
	@Update("update xhy_server set server_name=#{server_name},server_ip=#{server_ip},server_user=#{server_user},server_pwd=#{server_pwd},server_desc=#{server_desc},config_dir=#{config_dir}")
	public int update(HostServer server);
	
	@Delete("delete from xhy_server where server_id = #{serverId}")
	public int delete(@Param("serverId") int serverId);
	
	@Select("select * from xhy_server where server_id = #{serverId}")
	public HostServer getById(@Param("serverId") int serverId);
}
